package com.googlecode.bip.dao;

import java.io.Serializable;
import java.sql.SQLException;
import java.util.Map;
import javax.naming.NamingException;
import com.googlecode.bip.entity.ILocal;
import com.googlecode.bip.entity.IllegalIdLocalException;


/**
 * DAO for {@link ILocal}
 */
public interface LocalDAO extends Serializable
{
    /**
     * Resolve ILocal for a giving idlocal
     *
     * @param idlocal idlocal to resolve
     * @return ILocal if exist, or null if not exist
     * @throws NamingException if any
     * @throws SQLException if any
     */
    public ILocal findLocal( final String idlocal )
        throws NamingException, SQLException;

    /* *
     * Unsupported Operation
     *
     * @throw UnsupportedOperationException
     * /
    public boolean insertLocal( final ILocal ilocal ); */

    /* *
     * Unsupported Operation
     *
     * @throw UnsupportedOperationException
     * /
    public boolean deleteLocal( final ILocal ilocal ); */


    /* *
     * Unsupported Operation
     *
     * @throw UnsupportedOperationException
     * /
    public boolean updateLocal( final ILocal ilocal ); */

    /**
     * Returns an unmodifiable Map of (idlocal,name)
     *
     * @return an unmodifiable Map of (idlocal,name)
     * @throws NamingException if any
     * @throws SQLException if any
     */
    public Map<String,String> getLocalMap()
        throws NamingException, SQLException;

    /**
     * Use this when a new local entry is added
     */
    public void reset();

    /**
     * Returns a valid idlocal
     *
     * @param idlocal idlocal to standardize and validate
     * @return a valid idlocal if possible
     * @throws IllegalIdLocalException if idlocal is not valid.
     */
    public String getValidIdLocal( String idlocal )
        throws IllegalIdLocalException;

}
